Filter hook 'rest_{$this->post_type}_query'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php at line 366

Description

Filters WP_Query arguments when querying posts via the REST API. The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug. Possible hook names include: - `rest_post_query` - `rest_page_query` - `rest_attachment_query` Enables adding extra arguments or setting defaults for a post collection request.

Occurrences

Filename Line Number
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 366

Parameters

Type Name Description
array $args Array of arguments for WP_Query.
WP_REST_Request $request The REST API request.

PHP Doc

/**
		 * Filters WP_Query arguments when querying posts via the REST API.
		 *
		 * The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug.
		 *
		 * Possible hook names include:
		 *
		 *  - `rest_post_query`
		 *  - `rest_page_query`
		 *  - `rest_attachment_query`
		 *
		 * Enables adding extra arguments or setting defaults for a post collection request.
		 *
		 * @since 4.7.0
		 * @since 5.7.0 Moved after the `tax_query` query arg is generated.
		 *
		 * @link https://developer.wordpress.org/reference/classes/wp_query/
		 *
		 * @param array           $args    Array of arguments for WP_Query.
		 * @param WP_REST_Request $request The REST API request.
		 */